package myPost

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
)

func SendPostRequest(path string, contentType string, data string) {

	//发送Post请求
	resp, err := http.Post(path, contentType, strings.NewReader(data))
	if err != nil {
		fmt.Printf("post failed, err:%v\n", err)
		return
	}
	//关闭响应
	defer resp.Body.Close()

	//读取响应体
	b, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Printf("get resp failed, err:%v\n", err)
		return
	}
	fmt.Println(string(b))
}
